import java.util.Scanner;

/**
 * Created with IDEA
 * author:ju bai
 * Date:2021/5/11
 * Time:21:44
 **/
public class Main1 {
    /**
     * 每日一题 - 洗牌问题
     * @param args 
     */
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while(sc.hasNext()) {
            int groups = sc.nextInt();
            for (int i = 0; i < groups; i++) {
                int n = sc.nextInt();
                int k = sc.nextInt();
                int[] cards = new int[2*n];
                for (int j = 0; j < 2*n ; j++) {
                    cards[j] = sc.nextInt();
                }
                playCard(cards,n,k);
            }
        }
    }

    /**
     * 洗牌操作
     * @param cards 牌面数组
     * @param n 牌数的一半
     * @param k 洗牌次数
     */
    public static void playCard(int[] cards,int n,int k){
        //i从0开始
        // i-->2i
        //i+n-->2i+1
        for (int i = 0; i < k; i++) {
            //一次洗牌的过程
            int[] newCards = new int[cards.length];
            //遍历编号为0~n-1的牌
            for (int j = 0; j < n; j++) {
                newCards[2*j] = cards[j];// i-->2i
                newCards[2*j+1] = cards[j+n];//i+n-->2i+1
            }
            cards = newCards;
        }
        //从上往下打印
        printCards(cards);
    }

    /**
     * 输出：以空格相隔，最后一个后无空格
     * @param cards
     */
    private static void printCards(int[] cards) {
        for (int i = 0; i < cards.length-1; i++) {
            System.out.print(cards[i]+" ");//先输出前面的
        }
        System.out.println(cards[cards.length-1]);//输出最后一个数，无空格
    }
}
